<template>
	<view>
		<view v-if="type == 1" class="payBOx">
			<view class="payTop">
				<img alt="" class="payImg"
					src="https://hzdaoziji.oss-cn-hangzhou.aliyuncs.com/file177f2a286d9441699dbd919864c5cd2b.png">
				<view class="payTitle">
					核销成功
				</view>
			</view>
			<view class="payText">
				<!-- 可在个人中心-行程管理中管理您的行程 -->
			</view>
			<view class="payBotton" style="background: #f59a23;" @click="toUrl(1,'/pages/me/journey')">
				继续核销
			</view>
			<view class="payBotton" @click="toUrl(2,'/pages/home/index')">
				返回首页
			</view>
		</view>
		<view v-if="type == 2" class="payBOx">
			<view class="payTop">
				<img alt="" class="payImg"
					src="https://hzdaoziji.oss-cn-hangzhou.aliyuncs.com/file2d8d9574d7c544b2867ab65d7f1cf490.png">
				<view class="payTitle">
					核销失败
				</view>
			</view>
			<view class="payText">
				请刷新二维码再试
			</view>
			<view class="payBotton" style="background: #f59a23;" @click="toUrl(1,'/pages/me/allPlans')">
				继续核销
			</view>
			<view class="payBotton" @click="toUrl(2,'/pages/home/index')">
				返回首页
			</view>
		</view>
		<view v-if="type == 3" class="payBOx">
			<view class="payTop">
				<img alt="" class="payImg"
					src="https://hzdaoziji.oss-cn-hangzhou.aliyuncs.com/file2d8d9574d7c544b2867ab65d7f1cf490.png">
				<view class="payTitle">
					取消核销
				</view>
			</view>
			<view class="payText">
				<!-- 请刷新二维码再试 -->
			</view>
			<view class="payBotton" style="background: #f59a23;" @click="toUrl(1,'/pages/me/allPlans')">
				继续核销
			</view>
			<view class="payBotton" @click="toUrl(2,'/pages/home/index')">
				返回首页
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				type: 1
			}
		},
		onLoad(data) {
			console.log(data);
			this.type = data.type

		},
		methods: {
			toUrl(data, url) {
				if (data == 2) {
					console.log('返回主页');
					uni.switchTab({
						url: url
					});
				} else {
					// uni.navigateTo({
					// 	url
					// })
					uni.scanCode({
						success: function(res) {
							uni.navigateTo({
								url: "/" + res.path
							});
							console.log('条码类型：' + res.scanType);
							console.log('条码内容：' + res.result);
						}
					});
				}

			}
		}
	}
</script>

<style lang="scss" scoped>
	.payBOx {
		width: 400rpx;
		margin: auto;

		.payTop {
			margin-top: 100px;
			display: flex;
			justify-content: center;

			.payImg {
				width: 90rpx;
				height: 90rpx;
			}

			.payTitle {
				font-size: 60rpx;
				font-weight: 600;
				margin-left: 30rpx;
			}
		}

		.payText {
			font-size: 34rpx;
			font-weight: 600;
			margin: 100rpx 0;
		}

		.payBotton {
			margin: 40rpx 0;
			padding: 20rpx 0;
			border-radius: 16rpx;
			text-align: center;
			color: #fff;
			background-color: #169bd5;
		}
	}
</style>